<template>
  <div class="content">
    <img src="~@/assets/image/bg.png" alt="" />
    <div class="bottom">技术支持：特提工科</div>
    <div class="main">
      <div class="title">江都建设资金往来账管理系统</div>
      <!-- <div class="title">123456789</div> -->
      <div class="list">
        <div class="left">+86</div>
        <div class="right">
          <input type="number" />
        </div>
      </div>
      <div class="list-1">
        <div class="left" data-tip="验证码有误，请重新输入">
          <input type="number" />
          <!-- <div class="icon yes"></div> -->
          <div class="icon wrong">x</div>
        </div>
        <div class="right" @click="btnCode">{{ verifyCode }}</div>
      </div>
      <div class="btn">登&nbsp;&nbsp;录</div>
    </div>
  </div>
</template>
<script>
export default {
  name: "login",
  data() {
    return {
      verifyCode: "获取验证码",
      timer: null
    };
  },
  beforeDestroy() {
    window.clearInterval(this.timer);
  },
  methods: {
    btnCode() {
      if (parseInt(this.verifyCode)) {
        return false;
      }
      let verifyCode = 60;
      this.verifyCode = `${verifyCode}s`;
      this.timer = setInterval(() => {
        if (verifyCode < 1) {
          window.clearInterval(this.timer);
          this.verifyCode = "获取验证码";
          return false;
        }
        verifyCode = verifyCode - 1;
        this.verifyCode = `${verifyCode}s`;
      }, 1000);
    }
  }
};
</script>

<style scoped lang="scss">
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
input[type="number"] {
  -moz-appearance: textfield;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

[data-tip] {
  position: relative;

  &::after {
    position: absolute;
    left: 0;
    top: 76px;
    content: attr(data-tip);
    font-size: 12px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: rgba(227, 78, 39, 1);
  }
}

.content {
  width: 100%;
  height: 100vh;
  overflow: hidden;
  position: relative;

  img {
    width: calc(100% + 74px);
    position: absolute;
    left: -37px;
    top: 0;
  }

  .bottom {
    position: absolute;
    bottom: 40px;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 14px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: rgba(0, 0, 0, 0.4);
  }

  .main {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 640px;
    height: 504px;
    background: rgba(255, 255, 255, 1);
    box-shadow: 0px 4px 16px rgba(53, 62, 71, 0.08);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;

    .title {
      width: 100%;
      text-align: center;
      font-size: 24px;
      font-family: Microsoft YaHei;
      font-weight: bold;
      color: rgba(0, 0, 0, 1);
      margin: 64px 0;
    }

    input {
      width: 100%;
      height: 100%;
      background: none;
      outline: none;
      border: none;
      padding: 0 24px;
      font-size: 20px;
      font-family: Arial;
      font-weight: 400;
      color: rgba(0, 0, 0, 1);
    }

    input:focus {
      border: none;
    }

    .list {
      width: 100%;
      height: 96px;
      display: flex;
      flex-direction: row;
      justify-content: center;
      align-items: flex-start;

      .left {
        width: 100px;
        height: 64px;
        background: rgba(255, 255, 255, 1);
        border: 1px solid rgba(232, 238, 242, 1);
        border-radius: 4px 0px 0px 4px;
        font-size: 20px;
        font-family: Arial;
        font-weight: 400;
        line-height: 64px;
        text-align: center;
        color: rgba(0, 0, 0, 0.48);
      }

      .right {
        width: 420px;
        height: 64px;
        background: rgba(255, 255, 255, 1);
        border: 1px solid rgba(232, 238, 242, 1);
        border-left: 0;
        opacity: 1;
        border-radius: 0 4px 4px 0;
      }
    }

    .list-1 {
      width: 100%;
      height: 96px;
      display: flex;
      flex-direction: row;
      justify-content: center;
      align-items: flex-start;

      .left {
        width: 324px;
        height: 64px;
        background: rgba(255, 255, 255, 1);
        border: 1px solid rgba(232, 238, 242, 1);
        border-radius: 4px;
        margin-right: 16px;
        position: relative;

        .icon {
          position: absolute;
          right: 12px;
          top: 22px;
          width: 20px;
          height: 20px;
          border-radius: 50%;
          text-align: center;
          line-height: 20px;
          user-select: none;
        }

        .yes {
          background: rgba(112, 182, 3, 1);

          &::after {
            content: "";
            position: absolute;
            top: 2px;
            left: 3px;
            width: 17px;
            height: 7px;
            border: 1px solid #fff;
            transform: rotate(-45deg);
            border-right: 0;
            border-top: 0;
          }
        }

        .wrong {
          background: #e34e27;
          color: #fff;
          cursor: pointer;
        }
      }

      .right {
        width: 180px;
        height: 64px;
        text-align: center;
        background: rgba(255, 255, 255, 1);
        border: 1px solid rgba(232, 238, 242, 1);
        border-radius: 4px;
        font-size: 18px;
        font-family: Microsoft YaHei;
        font-weight: 400;
        line-height: 64px;
        color: rgba(0, 0, 0, 0.48);
        user-select: none;
        cursor: pointer;

        &:active {
          opacity: 0.8;
        }
      }
    }

    .btn {
      width: 520px;
      height: 64px;
      line-height: 64px;
      text-align: center;
      background: rgba(4, 112, 212, 1);
      border-radius: 4px;
      font-size: 20px;
      font-family: Microsoft YaHei;
      font-weight: 400;
      color: rgba(255, 255, 255, 1);
      cursor: pointer;
      user-select: none;
      margin-top: 8px;

      &:active {
        opacity: 0.8;
      }
    }
  }
}
</style>
